<extend name="Public/base"/>



<block name="body">

    <!-- 标题栏 -->

    <div class="main-title">

        <h2>{$meta_title}{$recycle}</h2>

    </div>

     <!-- 高级搜索 -->
        <div class="search-form  col-xs-2 text-right">
            <div class="input-group">
                <input type="text" name="keyword" class="search-input form-control" value="{:I('keyword')}" placeholder="用户">
                                 <span class="input-group-btn">  <a class="btn btn-default" href="javascript:;" id="search" url="{:U('updateBillTmp',array('batch'=>$_list[0]['batch']))}"><i class="icon-search"></i></a></span><br/>
            </div>
        </div>

    <!-- 数据列表 -->
    <div  class="data-table with-padding">

        <table class="table table-bordered table-striped ">

            <thead>

            <tr>

                <th class="">id</th>

                <th class="">单位</th>

                <th class="">用户</th>

                <th class="">缴费项</th>

                <th class="">缴费金额</th>
                <th class="">上次结余</th>

                <th class="">创建时间</th>

                <th class="">状态</th>

                <th class="">操作</th>

            </tr>

            </thead>

            

            <tbody>

            <notempty name="_list">

                <volist name="_list" id="vo">

                    <tr style="color:deepskyblue;border: 2px solid deepskyblue; font-family: '微软雅黑'; font-weight: bold;">

                        <td style="background: rgba(93,200,205,1);color:#fff;">{$vo.id}</td>

                        <td>{$vo.unit_title}</td>

                        <td>{$vo.nickname}</td>

                        <td>{$vo.ititle}</td>

                        <td>{$vo.amount}</td>
                        <td></td>

                        <td>{$vo.create_time|time_format}</td>

                        <td>{$vo.status}</td>

                        <td>
                            <a class="status status_1" href="{:U('editBillTmp',array('id'=>$v[id],'amount'=>$v['amount'],'batch'=>$vo['batch']))}">编辑</a>
                        </td>

                    </tr>

                    <volist name="vo.sub" id="v">

                        <tr>

                            <td>{$v.id}</td>

                            <td>{$v.unit_title}</td>

                            <td>{$v.nickname}</td>

                            <td>{$v.ptitle}</td>

                            <td>{$v.amount}</td>
                           
                            <td><input type="text" id="last_amount" class="last_amount" value="{$v.last_amount}" size="12" maxlength="6" tid="{$v.id}"/></td>
                            
                            
                            <td>{$v.create_time|time_format}</td>

                            <td>{$v.status}</td>

                            <td>

                                <a class="status status_1" href="{:U('editBillTmp',array('id'=>$v[id],'amount'=>$v['amount'],'batch'=>$vo['batch']))}">编辑</a>
                            </td>

                        </tr>

                    </volist>
                </volist>
                <else/>

                <td colspan="10" class="text-center">{:L('_ADMIN_USER_EMPTY_')}</td>

            </notempty>

            </tbody>

        </table>
        <form action="__SELF__" method="post">
            
            <input type="hidden" name="batch" value="{$_list[0]['batch']}" />
            <input type="submit" value="确认生成" class="btn submit-btn " onclick="javascript:if(confirm('确实要生成全部账单吗?')){return true;}else{return false;}"/>
        </form>
    </div>

    <div class="with-padding">

        {$_page}

    </div>

</block>



<block name="script">

    <script src="__CSS__/status.css"></script>

    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    

    <script type="text/javascript">

    $('.last_amount').blur(function(){

      var amount = $(this).val();
      var id = $(this).attr('tid');
      // if(confirm("确定要修改吗？")){
      $.ajax({
             type: "get",
             url: "{:U('Pay/change_amount')}",
             data: {amount:amount,id:id},
             
             dataType: "json",
             

             success: function(data){
                     
              window.location.reload(); 
             }
      });  

});

        //搜索功能

        $("#search").click(function () {

            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');

            query = query.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {

                url += '&' + query;

            } else {

                url += '?' + query;

            }

            window.location.href = url;

        });

        //回车搜索

        $(".search-input").keyup(function (e) {

            if (e.keyCode === 13) {

                $("#search").click();

                return false;

            }

        });

        //导航高亮

        highlight_subnav('{:U('bill')}');



    </script>

</block>